package com.whmskj.xjlhbc.domain;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.Date;

@Data
@TableName(value = "rundata_info")
public class RundataInfo {
    @TableId(type = IdType.AUTO)
    private String id;

    @Schema(description = "机器id")
    private String macid;

    @Schema(description = "品种")
    private String variety;

    @Schema(description = "")
    private String classname;

    @Schema(description = "挡车工")
    private String employee;

    @Schema(description = "状态")
    private String loomstate;

    @Schema(description = "当班效率")
    private double efficiency;

    @Schema(description = "当班产量")
    private double clothlength;

    @Schema(description = "转速")
    private int speed;

    @Schema(description = "角度")
    private int macangle;

    @Schema(description = "刹车角度_开始")
    private int brakeangle_start;

    @Schema(description = "刹车角度_结束")
    private int brakeangle_end;

    @Schema(description = "刹车角度_距离")
    private int brakeangle_distance;

    @Schema(description = "当班打纬数")
    private int weftcount;

    @Schema(description = "纬密")
    private int weftdensity;

    @Schema(description = "天经张力_设置值")
    private int tension_celestial_set;

    @Schema(description = "天经张力_实际值")
    private int tension_celestial_actual;

    @Schema(description = "地经张力_设置值")
    private int tension_ground_set;

    @Schema(description = "地经张力_实际值")
    private double tension_ground_actual;

    @Schema(description = "当班开始时间")
    private String startdatetime;

    @Schema(description = "当班运行时间（s）")
    private int runtime;

    @Schema(description = "当班运行时间")
    private String runtime_format;

    @Schema(description = "落布预测（s），多少s后落布")
    private Date piececut_datetime;

    @Schema(description = "布匹_实际值（已织）")
    private double piececut_woven;

    @Schema(description = "布匹_设置值")
    private int piececut_set;

    @Schema(description = "布匹进度")
    private String piececut_progress;

    @Schema(description = "布匹长度")
    private String piececut_length;

    @Schema(description = "预计了轴")
    private String warpbeam_ground_datetime;

    @Schema(description = "预计了轴剩余时长")
    private String sysc;

    @Schema(description = "预计了轴剩余时长,秒数")
    private Integer syscm;
    @Schema(description = "预计了轴剩余时长,缩率秒数")
    private Long syscmsl;

    @Schema(description = "经轴进度")
    private String warpbeam_celestial_progress;

    @Schema(description = "经轴长度")
    private String warpbeam_celestial_length;

    @Schema(description = "天经经轴_设定值（满轴长度）")
    private int warpbeam_celestial_total;

    @Schema(description = "天经经轴_实际值（已织）")
    private int warpbeam_celestial_woven;

    @Schema(description = "地经经轴_设定值（满轴长度）")
    private int warpbeam_ground_total;

    @Schema(description = "地经经轴_实际值（已织）")
    private long warpbeam_ground_woven;

    @Schema(description = "停车原因")
    private String stopreason;

    @Schema(description = "报警信息")
    private String alarm;

    @Schema(description = "时间")
    private String ts;

    //今日了轴
    public boolean isWarpbeamGroundDatetimeToday(){
        if(!StringUtils.hasText(warpbeam_ground_datetime)) return false;
        String str = DateUtil.parse(warpbeam_ground_datetime).toDateStr();
        String str1 = DateUtil.date().toDateStr();
        return str.equals(str1);
    }

}
